package com.swpu;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "LoginServlet",urlPatterns = "/login")
public class LoginServlet extends HelloServlet{
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String username = "admin";
        String userpwd = "123456";
        if (username.equals("admin") && userpwd.equals("123456")) {
            response.sendRedirect("/javaweb/welcome.jsp");
        }else{
            response.sendRedirect(".javaweb/login.jsp");
        }
    }



}
